<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="layout">
	<tiles:putAttribute name="head">
		<style type="text/css">
.selected {
	visibility: hidden;
}
</style>
		<script type="text/javascript">
			$(function() {
				$(".date").datepicker({
					showWeek : true,
					firstDay : 1,
					dateFormat : 'yy-mm-dd',
					showOtherMonths : true,
					selectOtherMonths : true
				});
				$("#datepicker").datepicker({
					showWeek : true,
					firstDay : 1,
					dateFormat : 'yy-mm-dd',
					showOtherMonths : true,
					selectOtherMonths : true,
					onSelect : function(date, source) {
						$("form").submit();
					}
				});
			});
		</script>
	</tiles:putAttribute>
	<tiles:putAttribute name="mainBody">
		<div>
			<a href="listSubject">所有课程</a>
			<span>课程内容选择 <a href="listSubject?form=VIP">VIP课程</a> <a href="listSubject?form=Normal">非VIP课程</a>
			</span> <span>课程内容选择 <s:iterator value="contents" var="content">
					<a href="listSubject?content=${content.id}">${content.name} </a>
				</s:iterator>
			</span> <span>课程计费方式选择 <a href="listSubject?model=Month">按月</a> <a href="listSubject?model=Day">按日</a> <a href="listSubject?model=Hour">按时</a>
			</span>
		</div>
		<div>每页${subjects.size}项，共 ${subjects.totalElements} 项，当前${subjects.number+1}/ ${subjects.totalPages}页</div>
		<table class="table">
			<thead>
				<tr>
					<th>名称</th>
					<th>描述</th>
					<th>课程形式</th>
					<th>课程内容</th>
					<th>收费形式</th>
					<th>课程时间</th>
				</tr>
			</thead>
			<tbody>
				<s:iterator value="subjects" var="subject">
					<tr>
						<td><s:url id="modifySubject" action="modifySubject" namespace="/subject">
								<s:param name="id" value="id"></s:param>
							</s:url> <a href="${modifySubject}"> ${subject.name} </a></td>
						<td>${subject.name}</td>
						<td><s:property value="form" /></td>
						<td><s:iterator value="contents" var="content" status="status">
								${content.name}
								<s:if test="!#status.last">,</s:if>
							</s:iterator></td>
						<td><s:property value="billingModel" /></td>
						<td><s:if test="billingModel.toString() == '按月'">
						${subject.months}月
						</s:if> <s:elseif test="billingModel.toString() == '按天'">
						${subject.days}天
						</s:elseif> <s:else>
						${subject.hours}课时
						</s:else></td>
					</tr>
				</s:iterator>
			</tbody>
			<tfoot></tfoot>
		</table>
		<jsp:include page="/components/pagination/paginations.jsp"></jsp:include>
	</tiles:putAttribute>
</tiles:insertDefinition>